How to Design a Feature Engineering Pipeline
A Feature Engineering (FE) pipeline should be designed based on the characteristics of your source data and the objective of your machine learning model. Instead of adding all the available nodes, select only the nodes that improve the quality and usefulness of the data for your intended downstream task.
This section explains how to evaluate your data, identify the required transformations, and choose the appropriate Feature Engineering nodes.
Understanding your source data
Determining the downstream objective
Selecting the processing nodes
Understanding your source data
Before selecting any Feature Engineering techniques, you must examine the source data to understand its quality and structure.
Review the dataset for the following characteristics:
Data quality
Identify issues that may affect the performance of your ML models, such as:
-
Missing values
-
Duplicate records
-
Invalid or inconsistent values
-
Incorrect data types
-
Empty columns
-
High-cardinality categorical columns
Data distribution
Analyze the distribution of numerical features to determine whether:
-
Features have significantly different ranges
-
Outliers are present
-
The data is skewed
-
Features require normalization or scaling
Data Categories
Different data categories require different preprocessing techniques. So it is important to determine the types of data categories available in the dataset:
-
Numerical
-
Categorical
-
Date and time
-
Text
-
Boolean
Target column
If you are building a supervised machine learning model, identify the target variable (also called the target column). This is the column whose value the model is trained to predict.
For example:
|
Customer ID |
Age |
Monthly Spend |
Churn |
|---|---|---|---|
|
C101 |
35 |
4500 |
Yes |
|
C102 |
42 |
6200 |
No |
|
C103 |
28 |
3100 |
Yes |
In this dataset, Churn is the target variable because the model is trained to predict whether a customer will leave (Yes or No).
After identifying the target variable, consider the following:
-
Are the target values balanced?
Check whether each target value has a similar number of records. For example, if 95% of customers have No for churn and only 5% have Yes, the data is imbalanced. In such cases, you may need to use an Imbalance Handling node before training the model.
-
What type of prediction are you making?
Determine whether the model is predicting:
-
A category (Classification): For example, predicting whether a customer will churn (Yes/No) or whether a transaction is Fraud/Not Fraud.
-
A numeric value (Regression): For example, predicting the house price, sales amount, or temperature.
-
-
Does the target variable require preprocessing?
Some target variables may need preprocessing before training. For example, categorical values such as High, Medium, and Low may need to be encoded into numerical values. Similarly, if the target variable contains missing values, you may need to clean or impute the data before training
Determining the downstream objective
The design of a Feature Engineering pipeline should support the intended machine learning objective. Every pipeline may not require all processing steps. Include only the nodes that improve the suitability of the data for the selected model.
For example:
| Objective | Feature Engineering Activities |
|---|---|
| Improve data quality | Data Cleaning, Imputation, Duplicate Removal |
| Prepare data for machine learning | Encoding, Scaling, Outlier Handling |
| Handle class imbalance | SMOTE, Oversampling, Under sampling |
| Create more predictive features | Feature Creation, Feature Selection |
| Combine data from multiple sources | Join |
| Prepare data for model evaluation | Train/Test Split or Train/Validation/Test Split |
Selecting the processing nodes
Here is a decision matrix that can help you decide which nodes to add to your Feature Engineering pipeline.
|
If your dataset ... |
Useā¦.. |
|---|---|
|
Contains missing values |
Imputation |
|
Contains duplicate or inconsistent data |
Data Cleaning |
|
Contains categorical columns |
Encoding |
|
Contains features with different numerical ranges |
Scaling |
|
Contains extreme values |
Outlier Handling |
|
Has an imbalanced target variable |
Imbalance Handling |
|
Requires calculated features |
Feature Creation |
|
Combines multiple datasets |
Join |
|
Must be divided for model training |
Train/Test Split or Train/Validation/Test Split |
|
What's next? Components of Feature Engineering |